#ifndef __DIRENT_DIRENT_H__
#define __DIRENT_DIRENT_H__

#include <types.h>

/* findfile() */
#define END_OF_DIR      (-1)

/* atributy DirectoryEntry */
#define F_READONLY  (1)
#define F_HIDDEN    (2)
#define F_SYSTEM    (4)
#define F_VOLUME    (8)
#define F_DIRECTORY (16)
#define F_ARCHIVE   (32)

/* navratove hodnoty funkci */
#define MKDIR_OK             (1)
#define MKDIR_FAILED         (0)

/* struktura casu u souboru */
typedef struct {
	unsigned int
		sec          :5,
		min          :6,
		hour         :5;
} FileTime;

/* struktura data u souboru */
typedef struct {
  unsigned int
    day          :5,    /* 5 je pocet bitu kolikami se vyjadruje pocet dni v mesici 2^5 = 32-1 = 31dni */
    month        :4,    /* 2^4-1=15 max 15 mesicu, nam staci jen 12 :) */
    year         :7;    /* rok - 1980 */
} FileDate;

/* struktura celeho souboru ve FAT */
typedef struct {
  unsigned char name[8];          /* jmeno */
  unsigned char ext[3];           /* pripona */
  unsigned char attr;             /* atribut */
  unsigned char reserved[0x0A];   /* ... */
  FileTime time;                  /* cas */
  FileDate date;                  /* datum */
  unsigned int ClstrNo;           /* pocatecni cluster */
  unsigned long filesize;         /* velikost souboru */
  unsigned char realname[13];     /* skutecne jmeno + pripona + '\0' */
} DirectoryEntry;

struct ffblk	{
  char far *    path;
  unsigned int  attr;
  int           ff_reserved;
  unsigned char ff_attrib;
  unsigned int  ff_ftime;
  unsigned int  ff_fdate;
  unsigned int  ff_fsize;
  unsigned char ff_name[13];
};

#endif
